package com.atguigu.springboot.service.impl;

import com.atguigu.springboot.entity.Book;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/01 13:59 周二
 * @description :
 */
@Service
public class BookServiceImpl {

    @RabbitListener(queues = "atguigu.news")
    public void receive(Book book) {
        System.out.println("收到消息" + book);
    }

    @RabbitListener(queues = "atguigu")
    public void receiveHead(Message message) {
        System.out.println(Arrays.toString(message.getBody()));
        System.out.println(message.getMessageProperties());
    }
}
